﻿using System;
using System.Text;
using System.IO;
using System.Collections.Generic;
using RMS.Utils.Dicom.DataStructure;


namespace RMS.Utils.Dicom.Commen
{
    public abstract class DicomBase : IDicomBase
    {
        private bool IsParsed;

        protected ImageData imgData;

        protected List<DataElement> _dicomData;
        public List<DataElement> DicomData
        {
            get
            {
                if (!IsParsed)
                {
                    this.paresDicom();
                    IsParsed = true;
                }
                return this._dicomData;

            }
        }

        public DicomBase(String DicomFilePath)
        {
            imgData = new ImageData();
            _dicomData = new List<DataElement>();
            StreamFile.FilePath = DicomFilePath;
            TransferSyntax.CheckUID(Constants.DefaultUID);
        }

        public DicomBase()
        {
            imgData = new ImageData();
            _dicomData = new List<DataElement>();
            TransferSyntax.CheckUID(Constants.DefaultUID);
        }

        protected abstract void paresDicom();

        public string FilePath
        {
            set
            {
                StreamFile.FilePath = value;
            }
        }


        public abstract bool IsDicoomFile { get; }
        public abstract void SaveImage(string FilePath);
        public abstract void SaveDicomAsXml(String path);


    }

}
